package com.study.mapper;

import com.study.entity.BusReceiverEntity;
import org.apache.ibatis.annotations.*;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

@Mapper
//使用@Mapper注解要定义成一个接口interface
/*作用：
1.使用@Mapper将NewsDAO接口交给Spring进行管理
2.不用写Mapper映射文件（XML）
3.为这个NewsDAO接口生成一个实现类，让别的类进行引用
 */
public interface BusReceiverMapper {

    BusReceiverEntity findById(Integer id);

    @Insert("INSERT INTO bus_receiver(name,region_code,address) VALUES(#{name}, #{regionCode}, #{address})")
    void insert(BusReceiverEntity receiver);

    @Delete("DELETE FROM bus_receiver WHERE id =#{id}")
    void delete(Serializable id);

    void batchInsert(List<BusReceiverEntity> list);

    List<BusReceiverEntity> findList(@Param("name")String name, @Param("address")String address);

    List<BusReceiverEntity> findListByPage(Map<String, Integer> map);

    List<BusReceiverEntity> findAll();

//    List<BusReceiverEntity> findList(Map<String,Object> params);
//
//    List<BusReceiverEntity> findList(BusReceiverEntity entity);

}

//记住：接口名与Mybatis的映射文件名一定要一模一样